#!/bin/sh

. /etc/init.d/functions

DAEMON="/usr/bin/motion"
DAEMON_OPTS=

case "${1}" in
        start)
                log_begin_msg -n "Starting motion"
                start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
                log_end_msg $?
                ;;

        stop)
                log_begin_msg -n "Stopping motion"
                start-stop-daemon --stop --quiet --exec $DAEMON
                log_end_msg $?
                ;;

        restart)
                ${0} stop
                sleep 1
                ${0} start
                ;;

        *)
                echo "Usage: ${0} {start|stop|restart|status}"
                exit 1
                ;;
esac
